﻿using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace XinGuanERP.Models.Po.business
{
    public class Product : PrivateCommonEntity<string>, IEntityTypeBuilder<Product>
    {
        public string? Name { get; set; }
        public string? Model { get; set; }
        public string? Unit { get; set; }
        public string? Remark { get; set; }
        public int? Sort { get; set; }
        public string? OneCategoryId { get; set; }
        public string? TwoCategoryId { get; set; }
        public string? ThreeCategoryId { get; set; }
        public string? ImageUrl { get; set; }
        public string? Status { get; set; }

        public void Configure(EntityTypeBuilder<Product> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder.ToTable("biz_product");
            entityBuilder.HasKey(t => t.Id);
            entityBuilder.Property(t => t.Id).HasColumnName("id");
            entityBuilder.Property(t => t.Name).HasColumnName("name");
            entityBuilder.Property(t => t.Model).HasColumnName("model");
            entityBuilder.Property(t => t.Unit).HasColumnName("unit");
            entityBuilder.Property(t => t.Remark).HasColumnName("remark");
            entityBuilder.Property(t => t.Sort).HasColumnName("sort");
            entityBuilder.Property(t => t.OneCategoryId).HasColumnName("one_category_id");
            entityBuilder.Property(t => t.TwoCategoryId).HasColumnName("two_category_id");
            entityBuilder.Property(t => t.ThreeCategoryId).HasColumnName("three_category_id");
            entityBuilder.Property(t => t.ImageUrl).HasColumnName("image_url");
            entityBuilder.Property(t => t.Status).HasColumnName("status");
            entityBuilder.Property(t => t.CreateTime).HasColumnName("CREATETIME");
            entityBuilder.Property(t => t.UpdateTime).HasColumnName("UPDATETIME");
            entityBuilder.Property(t => t.CreateUserId).HasColumnName("CREATEUSERID");
            entityBuilder.Property(t => t.CreateUserName).HasColumnName("CREATEUSERNAME");
            entityBuilder.Property(t => t.UpdateUserId).HasColumnName("UPDATEUSERID");
            entityBuilder.Property(t => t.UpdateUserName).HasColumnName("UPDATEUSERNAME");
        }
    }
}
